package com.appleyk.repository;

import com.appleyk.node.Tuser;
import com.appleyk.relation.Recomm;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.GraphRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RecommRepository extends GraphRepository<Recomm> {

    @Query("match(a:Tuser),(b:Tuser) where a.uid={0} and b.uid = {1}"
            + " create p = (a)-[r:Recomm]->(b) return a ")
    Tuser createLikes(Long startNodeID, Long endNodeID);


    @Query("Match data=(a:Tuser{uid:{0}})-[*2..3]->(b:Tuser) return data")
    List<Recomm> getRecomms(Long uid);

}
